import {MessageBox} from 'element-ui'

export default {
    alert (content, title = '温馨提示', btnText = '知道了') {
        MessageBox.alert(content, title, {
            confirmButtonText: btnText
        })
    },
    confirm (content, {confText = '确认', canText = '取消', title = '提示', onConfirm, onCancel}) {
        MessageBox.confirm(content, title, {
            confirmButtonText: confText,
            cancelButtonText: canText,
            type: 'warning'
        }).then(() => {
                if (typeof onConfirm === 'function') {
                    onConfirm()
                }
            }
        ).catch(() => {
            if (typeof onConfirm === 'function') {
                onCancel()
            }
        })
    }
}
